package com.acyouzi.huawei;

import java.util.Scanner;

/**
 * 17/9/26 19:16
 *
 * @author sunxu
 */
public class Main2 {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    String isbn = in.nextLine();
    if (isbn.length() != 11){
      System.out.println("ERROR");
      return;
    }
    String[] arr = isbn.split("-");
    if (arr.length != 3){
      System.out.println("ERROR");
      return;
    }
    if (arr[0].length() != 1 || arr[1].length() != 3 || arr[2].length() != 5){
      System.out.println("ERROR");
      return;
    }
    try {
      int num = Integer.parseInt(arr[0]+arr[1]+arr[2]);
      int code = 0;
      int count = 9;
      while (num != 0){
        code += (num % 10) * count--;
        num = num / 10;
      }
      code = code % 11;
      if (code == 10) System.out.println(isbn+"-X");
      else System.out.println(isbn+"-"+code);

    } catch (NumberFormatException e){
      System.out.println("ERROR");
    }
  }
}
